package com.zmm.zebulon.module.system.biz.dal.mysql.oauth2;

import com.zmm.zebulon.module.system.biz.dal.dataobject.oauth2.OAuth2RefreshTokenDO;
import com.zmm.zebulon.starter.mybatis.mybatis.core.mapper.BaseMapperX;
import com.zmm.zebulon.starter.mybatis.mybatis.core.query.LambdaQueryWrapperX;
import org.apache.ibatis.annotations.Mapper;

/**
 * description:  OAuth2 刷新令牌  Mapper
 *
 * @author zebulon
 * package com.zmm.zebulon.module.system.biz.dal.mysql.oauth2
 * name: OAuth2RefreshTokenMapper
 * date 2024/1/8 00:13
 */
@Mapper
public interface OAuth2RefreshTokenMapper extends BaseMapperX<OAuth2RefreshTokenDO> {

    default int deleteByRefreshToken(String refreshToken) {
        return delete(new LambdaQueryWrapperX<OAuth2RefreshTokenDO>()
                .eq(OAuth2RefreshTokenDO::getRefreshToken, refreshToken));
    }

    default OAuth2RefreshTokenDO selectByRefreshToken(String refreshToken) {
        return selectOne(OAuth2RefreshTokenDO::getRefreshToken, refreshToken);
    }

}
